<?php
$str = '';
if( $results ) {
	foreach( $results as $result ) {
		$json = "";
		$items = $result->toArray();
		foreach( $items as $key => $value ) {
			
			$value = str_replace( "\t", "&nbsp;&nbsp;&nbsp;&nbsp;", $value );
			$value = str_replace( array("\r\n", "\n", "\r"), "<br/>", $value );
			
			$json .= ",\"$key\": \"$value\"";
		}
		
		$str .= ",{" . substr( $json, 1 ) . "}";
	}
}

echo "[";
echo substr( $str, 1 );
echo "]";